package com.xiangge.zuoye;

import java.util.Random;

public class Demo8 {
    public static void main(String[] args) {
        int[] arr = {2,588,888,1000,10000};
        getMoney(arr);
    }

    public static void getMoney(int[] arr) {
        int[] newarr = new int[arr.length];
        int i = 0;
        while (true) {

            int j = new Random().nextInt(arr.length-1 - 0 + 1) + 0;
            int num = arr[j];

            if (next(num,newarr)){
                System.out.println(arr[j]+"元的奖金被抽出");
                newarr[i] = arr[j];
                i++;
            }

            if (i==newarr.length){
                break;
            }
        }
    }

    private static boolean next(int num, int[] arr) {

        for (int i : arr) {
            if (num==i){
                return false;
            }
        }
        return true;

    }
}
